package PlaneTest;

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.net.URL;

public class GameUtil {
    public static Image ImageGame(String path)  {
//        File f = new File("d:/IDEA/IdeaTest/PlaneWar2/src");
        BufferedImage img = null;
//        try {
//            img = ImageIO.read(f);
//        } catch (IOException e) {
//            e.printStackTrace();
//        }
        URL u = GameUtil.class.getClassLoader().getResource(path);
        try {
            img =ImageIO.read(u);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return img;
    }
    public static void main(String[] args)  {
        Image img = GameUtil.ImageGame("images/BJ.jpg");
        System.out.println(img);
    }

}
